<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>文件上传</title>
<link href="${res}/js/swfupload/default.css" rel="stylesheet"
	type="text/css" />
<link href="${res }/css/public.css" rel="stylesheet" type="text/css" />
<link href="${res}/css/default.css" type="text/css" rel="stylesheet" />
<%@ include file="/common/simpleupload.jsp"%>
<script type="text/javascript" src="${res}/js/jquery-1.6.1.min.js"></script>
<script type="text/javascript"
	src="${res}/js/upload/handler/handlers.js"></script>
<script type="text/javascript">
var resPath="${res}";
var ctxPath="${ctx}";
var jsessionId = "<%=session.getId() %>";
var swfu;

SWFUpload.onload = function () {
	var settings = {
		flash_url : resPath+"/js/upload/swfupload.swf",
		upload_url: ctxPath+"/upload/upload",
		file_post_name:"fileData",
		post_params : {
			jsessionId:jsessionId
		},
		file_size_limit : "200 MB",
		file_types : "*.*",
		file_types_description : "All Files",
		file_upload_limit : 100,
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "fsUploadProgress",
			cancelButtonId : "btnCancel"
		},
		debug: false,

		// Button Settings
		button_image_url :resPath+"/image/btn_chosefile.gif",
	    button_width: "66",
	    button_height: "22",
	    button_placeholder_id : "spanButtonPlaceholder",

		// The event handler functions are defined in handlers.js
		swfupload_loaded_handler : swfUploadLoaded,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete,	// Queue plugin event
		
		// SWFObject settings
		minimum_flash_version : "9.0.28",
		swfupload_pre_load_handler : swfUploadPreLoad,
		swfupload_load_failed_handler : swfUploadLoadFailed
	};

	swfu = new SWFUpload(settings);
};

function uploadSuccess(file,response)
{
   try {
		var progress = new FileProgress(file, this.customSettings.progressTarget);
		progress.setComplete();
		progress.setStatus("Complete.");
		progress.toggleCancel(false);
		if(response)
		{  
			var result = eval(response);
			if(result)
			{
				for(var i = 0;i < result.length;i++)
				{
					$("#fileList").append('<div id="filecode'+result[i].filecode+'">[<a href="javascript:DelFile('+result[i].filecode+')">删除</a>]文件名：'+file.name+'&nbsp;&nbsp;备注:'+result[i].desc+'</div>');
				}
			}
		}
		
	} catch (ex) {
		this.debug(ex);
	}
   
}

</script>
</head>
<body>
<div id="menu"></div>
<form id="mainForm" action="fileUploadSimple.action" method="post">
<table class="simple_table">
	<tr>
		<td>
		<p>This page demonstrates the SWFObject plugin. Do each of the
		following (one at a time) to see the plugin work:</p>
		<ul>
			<li>Uninstall your Flash Player or install a version less than
			9.0.28</li>
			<li>Cause the SWF file to fail to load by deleting or renaming
			swfupload.swf (simulating a very slow or failed download)</li>
			<li>Disable JavaScript</li>
		</ul>
		<p>Each of these tests demontrate how these issues can be handled
		by SWFUpload and the SWFObject libraries.</p>
		<div id="divSWFUploadUI">
		<div class="fieldset  flash" id="fsUploadProgress"><span
			class="legend">Upload Queue</span></div>
		<p id="divStatus">0 Files Uploaded</p>
		<p><span id="spanButtonPlaceholder"></span> <input id="btnCancel"
			type="button" value="Cancel All Uploads" disabled="disabled"
			style="margin-left: 2px; height: 22px; font-size: 8pt;" /> <br />
		</p>
		</div>
		<noscript>
		<div
			style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px;">
		We're sorry. SWFUpload could not load. You must have JavaScript
		enabled to enjoy SWFUpload.</div>
		</noscript>
		<div id="divLoadingContent" class="content"
			style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
		message tip 1</div>
		<div id="divLongLoading" class="content"
			style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
		message tip 2</div>
		<div id="divAlternateContent" class="content"
			style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
		message tip 3</div>
		<div id="fileList"></div>
		</td>
	</tr>
</table>
</form>
</body>
</html>
